﻿@model PhoneBilling.Models.ExtensionSearchResultModel
@{
    ViewBag.Title = "分机查询";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script type="text/javascript">
    function motion() {
        var str = "";
        $(".account").each(function () {
            if ($(this).attr("checked") == "checked") {
                if (str == "")
                    str += $(this).attr("id");
                else
                    str += "!" + $(this).attr("id");
            }
        });

        window.location.href = "/Manage/ExtensionMotion?selectedItem=" + str;
    }
    function c1() {
        if ($(".c1").attr("checked") == "checked") {
            $(".account").attr("checked", "checked");
        }
        else {
            $(".account").removeAttr("checked");
        }
    }
    function del(name) {
        var r = confirm("确认删除分机：" + name + "吗？");
        if (r == true) {
            window.location.href = "/Manage/ExtensionDelete?id=" + name + "&isToSearch=true";
        }
        return false;
    }
</script>

@Html.HiddenFor(m => m.SelectItem, new { id = "SelectItem" })

@{
    var grid = new WebGrid(source: Model.ExtensionList, canPage: false);
}
@grid.GetHtml(
    alternatingRowStyle: "bg",
    columns: grid.Columns
    (
        grid.Column(format: (item) => Html.CheckBox("选择", true, new { id = item.分机号码, @class = "account" })),
        grid.Column("分机号码", "分机号码"),
        grid.Column("用户名", "用户名"),
        grid.Column("部组", "部组"),
        grid.Column("地址", "地址"),
        grid.Column("收费等级", "收费等级"),
        grid.Column("费率", "费率"),
        grid.Column("收费话类", "收费话类"),
        grid.Column("月杂费", "月杂费"),
        grid.Column("安装日期", "安装日期"),
        grid.Column(format: (item) => Html.ActionLink("修改", "ExtensionEdit", new { id = item.分机号码,isToSearch = true})),
        grid.Column(format: (item) => Html.ActionLink("迁移", "ExtensionMotion", new { selectedItem = item.分机号码,isToSearch = true })),
        grid.Column(format: (item) => Html.Raw(string.Format("<a href='javascript:' onclick=\"del('{0}','{1}')\">删除</a>", item.分机号码, item.分机号码)))
    )
)

